package function

import scala.beans.BeanProperty

/**
 * 函数作为参数示例
 *
 * @param a
 * @param b
 */
class Fun_Param {
  @BeanProperty
  val name:String="private"
  var name1:String= _
  def test(name:String,age:Int):Int={
    age
  }


}

object Fun_Param {
  def main(args: Array[String]): Unit = {
    val result: Int = fun(2, 4, _ * _)
    println(result)
    val result1: Int = fun3(3)(4)(_ + _)
    println(result1)
    val param = new Fun_Param()
    val i: Int = param.test("办公", 23)
    println(i)


  }

  def fun(a: Int, b: Int, fun1: (Int, Int) => Int): Int = {
    fun1(a, b)
  }

  def fun1(a: Int, b: Int): Int = {
    a + b
  }

  def fun3(a: Int)(b: Int)(fun4: (Int, Int) => Int): Int = {
    a * b+fun4(a,b)
  }
  def fun4(a:Int,b:Int):Int={
    a+b
  }


}
